package b.b.h;

import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.TypedValue;
import b.b.d.a.a;
import b.i.c.b.g;
import b.i.c.b.h;

/* compiled from: TintTypedArray */
public class f0 {
    public final Context a;
    public final TypedArray b;
    public TypedValue c;

    public f0(Context context, TypedArray typedArray) {
        this.a = context;
        this.b = typedArray;
    }

    public static f0 p(Context context, AttributeSet attributeSet, int[] iArr) {
        return new f0(context, context.obtainStyledAttributes(attributeSet, iArr));
    }

    public static f0 q(Context context, AttributeSet attributeSet, int[] iArr, int i, int i2) {
        return new f0(context, context.obtainStyledAttributes(attributeSet, iArr, i, i2));
    }

    public boolean a(int i, boolean z) {
        return this.b.getBoolean(i, z);
    }

    public int b(int i, int i2) {
        return this.b.getColor(i, i2);
    }

    public ColorStateList c(int i) {
        if (this.b.hasValue(i)) {
            int resourceId = this.b.getResourceId(i, 0);
            if (resourceId != 0) {
                ColorStateList a = a.a(this.a, resourceId);
                if (a != null) {
                    return a;
                }
            }
        }
        return this.b.getColorStateList(i);
    }

    public float d(int i, float f) {
        return this.b.getDimension(i, f);
    }

    public int e(int i, int i2) {
        return this.b.getDimensionPixelOffset(i, i2);
    }

    public int f(int i, int i2) {
        return this.b.getDimensionPixelSize(i, i2);
    }

    public Drawable g(int i) {
        if (this.b.hasValue(i)) {
            int resourceId = this.b.getResourceId(i, 0);
            if (resourceId != 0) {
                return a.b(this.a, resourceId);
            }
        }
        return this.b.getDrawable(i);
    }

    public Drawable h(int i) {
        if (this.b.hasValue(i)) {
            i = this.b.getResourceId(i, 0);
            if (i != 0) {
                Drawable g;
                e a = e.a();
                Context context = this.a;
                synchronized (a) {
                    g = a.a.g(context, i, true);
                }
                return g;
            }
        }
        return null;
    }

    public Typeface i(int i, int i2, g gVar) {
        int resourceId = this.b.getResourceId(i, 0);
        Typeface typeface = null;
        if (resourceId == 0) {
            return null;
        }
        if (this.c == null) {
            this.c = new TypedValue();
        }
        Context context = this.a;
        TypedValue typedValue = this.c;
        if (!context.isRestricted()) {
            typeface = h.d(context, resourceId, typedValue, i2, gVar, null, true);
        }
        return typeface;
    }

    public int j(int i, int i2) {
        return this.b.getInt(i, i2);
    }

    public int k(int i, int i2) {
        return this.b.getLayoutDimension(i, i2);
    }

    public int l(int i, int i2) {
        return this.b.getResourceId(i, i2);
    }

    public String m(int i) {
        return this.b.getString(i);
    }

    public CharSequence n(int i) {
        return this.b.getText(i);
    }

    public boolean o(int i) {
        return this.b.hasValue(i);
    }
}
